In computer programming, an application programming interface (API) is a set of routines, protocols, and tools for building software applications and services. An API expresses a software component in terms of the software component's operations, inputs, outputs, and underlying types.
A software component (e.g., an application, service or library) may provide an API, and methods defined by that API can be called (for example, from an application) in order to interact with the software component.
Recently, a trend in the area of API development has been to move towards a microservice architecture comprising small, decoupled applications that have a very specific purpose or function. An example of a microservice architecture is a customer database microservice which contains API methods that can be used to get/modify/delete existing customers and add new customers to the customer database. A more extreme example of a microservice is a lookup service that comprises a single method which takes a two letter country code and returns the full country name.
Typically, a developer of a single application will arrange the single application to call multiple API methods provided by multiple APIs. It is also likely that the developer will arrange the single application to use data returned by one API method to call another API method (that can potentially be in another API). For example, a developer may wish to retrieve and enrich a customer record in a database with the full country name of a country and currency in that country, before displaying a retrieved customer record to an end user. This would result in a sequence of linked API calls, such as:
(i) Take Customer ID->call GetCustomer( )in API#1->returns customer record
(ii) Extract country code from customer record->call CountryCodeToCountryName( )in API#->returns country name
(ii) Take country name->call GetCountryCurrency( )in APi#3->returns currency name
There are typically costs associated with making an API call (e.g., use of CPU processing time, network bandwidth, communication time, etc.). There may also be a “setup” cost associated with making an API call (e.g., calling a method in a REST API requires that an Hypertext Transfer Protocol (HTTP) connection is established across a network before the API method can be invoked). These costs can be incurred by both the consumer and provider of the called API.
There may also be the development cost associated with developing a sequence of linked API calls.